package com.example.demo.c;

import com.example.demo.base.B;
import com.example.demo.base.BaseControl;
import org.springframework.stereotype.Component;

/**
 * @author masc
 * @date 2022-09-07 16:33
 * <p></p>
 */
@Component
public class CControl extends BaseControl<C> {
    //为了满足策略模式中的工厂赋值 方便找到
    public CControl() {
        this.variantFormId = 3; //设置key值（容器中需要确保能唯一区分）
    }

    @Override
    public C queryVariant(String value) {
        System.out.println("传入的值:" + value);
        C c = new C();
        c.setCc("c里的cc值");
        c.setBb("c里的bb值");
        return c;
    }

    public void updateTest(B b) {
        C c = getVariantT(b); //B类转C类 仍能找到cc值
        System.out.println("更新C对象cc" + c.getCc());
        System.out.println("更新C对象bb" + c.getBb());
        //update C 类
    }
}
